#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from collections import Iterable

def iteratorList(_list):
    for l in _list:
        print(l)


def iteratorTuple(_tuple):
    for t in _tuple:
        print(t)


def iteratorDictKey(_dict):
    for key in _dict:
        print(key)


def iteratorDictValue(_dict):
    for value in _dict.values():
        print(value)


def iteratorDict(_dict):
    for key, value in _dict.items():
        print(key, value)


_list = [1, 3, 5, 2, 8, 90]
_tuple = (1, 3, 5, 2, 8, 90)
_dict = {'name': 'MaoMao', 'age': 25, 'sex': 1}

iteratorList(_list)
print('=====================')
iteratorTuple(_tuple)
print('=====================')
iteratorDictKey(_dict)
print('=====================')
iteratorDictValue(_dict)
print('=====================')
iteratorDict(_dict)

print('判断一个数据类型是否可迭代')
print(isinstance('123',Iterable))
print(isinstance(123,Iterable))
print(isinstance(_list,Iterable))
print(isinstance(_dict,Iterable))


